import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'datepicker';

  startDate: Date = null;
  endDate: Date = null;
  // startDate: any = '2020-12';
  // startDate: any;
  // endDate: any = '2020-12';
  initDate = '2020-12';

  /**
   * 监听开始时间控件返回值
   */
  handleSelectDate(dateObj) {
    // this.startDate = new Date(dateObj.date);
    console.log(dateObj);
  }

  /**
   * 监听开始时间控件返回值
   */
  handleStartDate(dateObj) {
    console.log(dateObj);
    this.startDate = new Date(dateObj.date);
  }

  /**
   * 监听结束时间控件返回值
   */
  handleEndDate(dateObj) {
    console.log(dateObj);
    this.endDate = new Date(dateObj.date);
  }
}
